(function () {
  "use strict";
  let userid = null;
  cookieStore.get("userid").then((res) => {
    if (res && res.value) {
      userid = res.value;
    }
  });
  const handler = {
    get(target, prop) {
      if (prop === "conversation/totalUnreadCount" && userid) {
        window.electron.send("totalUnreadCount", {
          userid,
          count: target[prop],
        });
      }
      return target[prop];
    },
  };

  $nuxt.$store.getters = new Proxy($nuxt.$store.getters, handler);
})();
